import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

public abstract class Serialization {
    public static void writeObject(Socket s, Object o) throws IOException {
        ObjectOutputStream os = new ObjectOutputStream(s.getOutputStream());
        os.writeObject(new Message(o));
        os.flush();
    }
    public static Object readObject(Socket s) throws ClassNotFoundException, IOException {
        ObjectInputStream io = new ObjectInputStream(s.getInputStream());
        Message o = (Message) io.readObject();
        return o.getMessage();
    }
}
